/**
 * com.sony.csl.j2me.net
 *  
 * Description:
 *   Utilities for J2ME CLDC/MIDP applications
 *   
 *   Released under OSS terms (see below) as part of LocationAPITools library:
 *     - http://code.google.com/p/locationapitools
 *   
 *   This code was developed within the scope of the NoiseTube project at
 *   Sony Computer Science Laboratory (CSL) Paris, for more information please refer to: 
 *     - http://noisetube.net
 *     - http://code.google.com/p/noisetube
 *     - http://www.csl.sony.fr
 * 
 * Author:
 *   Matthias Stevens (Sony CSL Paris / Vrije Universiteit Brussel)
 *   Contact: matthias.stevens@gmail.com
 * 	
 * License: 
 *   Copyright 2008-2009 Sony CSL Paris
 * 
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *          http://www.apache.org/licenses/LICENSE-2.0
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package com.sony.csl.j2me.net;

import com.sony.csl.j2me.util.StringUtils;

/**
 * @author mstevens
 *
 */
public abstract class HttpHttpsURL extends URI
{

	public HttpHttpsURL(String protocol, String hostname, int port, String path)
	{
		super(protocol, hostname, port, path);
	}
	
	public HttpHttpsURL(String protocol, String hostname, int port, String path, String username, String password)
	{
		super(protocol, hostname, port, path, username, password);
	}	

	/**
	 * @see com.sony.csl.j2me.net.URI#escapeCharacters(java.lang.String)
	 */
	protected String escapeCharacters(String uriPart)
	{
		uriPart = StringUtils.replace(uriPart, ' ', "%20");
		uriPart = StringUtils.replace(uriPart, '<', "%3C");
		uriPart = StringUtils.replace(uriPart, '>', "%3E");
		uriPart = StringUtils.replace(uriPart, '#', "%23");
		uriPart = StringUtils.replace(uriPart, '%', "%25");
		uriPart = StringUtils.replace(uriPart, '{', "%7B");
		uriPart = StringUtils.replace(uriPart, '}', "%7D");
		uriPart = StringUtils.replace(uriPart, '|', "%7C");
		uriPart = StringUtils.replace(uriPart, '\\', "%5C");
		uriPart = StringUtils.replace(uriPart, '^', "%5E");
		uriPart = StringUtils.replace(uriPart, '~', "%7E");
		uriPart = StringUtils.replace(uriPart, '[', "%5B");
		uriPart = StringUtils.replace(uriPart, ']', "%5D");
		uriPart = StringUtils.replace(uriPart, '`', "%60");
		uriPart = StringUtils.replace(uriPart, ';', "%3B");
		uriPart = StringUtils.replace(uriPart, '/', "%2F");
		uriPart = StringUtils.replace(uriPart, '?', "%3F");
		uriPart = StringUtils.replace(uriPart, ':', "%3A");
		uriPart = StringUtils.replace(uriPart, '@', "%40");
		uriPart = StringUtils.replace(uriPart, '=', "%3D");
		uriPart = StringUtils.replace(uriPart, '&', "%26");
		uriPart = StringUtils.replace(uriPart, '$', "%24");
		return uriPart;
	}

	/**
	 * @see com.sony.csl.j2me.net.URI#getDefaultPort()
	 */
	public abstract Integer getDefaultPort();
	
}
